{extend name="layout/layout" /}

{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-share font-dark"></i>
                    <span class="caption-subject font-dark bold uppercase"> 编辑专题</span>
                </div>
                <div class="actions">
                    <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;" data-original-title="" title=""> </a>
                </div>
            </div>
            <div class="portlet-body">
                <form class="form-horizontal" method="post" enctype="multipart/form-data">
                    <div class="form-body">
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        知识标题
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" placeholder="标题名称，最多80字" maxlength="80" data-required="1" name="title" value="{$info.title}" required>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        农事专题<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <select class="form-control" name="typeId">
                                            <option value="0">请选择</option>
                                            {volist name="typeList" id="vo"}
                                            <option value="{$vo.id}" {eq name="vo.name" value="$info.typeId"} selected {/eq} >{$vo.name}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        封面图<span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <div id="upload-image">
                                            <span id="upload-btn" data-multi="false">
                                                <input type="hidden" class="form-control" data-required="1" name="coverImg" value="{$info.imgUrl}">
                                                <img src="{$info.imgUrl}" alt="图片上传" style="width: 100px;height: 100px;" />
                                            </span>
                                        </div>
                                        <span class="help-block"> (建议尺寸：690*460) </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        排序
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" maxlength="4" name="sorting" value="100" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        知识概要
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <textarea name="content" class="form-control" cols="80" rows="10">{$info.content}</textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row contenttype">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        知识内容
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <div class="mt-radio-inline">
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="contentType" value="1" placeholder="" {eq name="info.contentType" value="1"} checked {/eq} >
                                                图片
                                                <span></span>
                                            </label>
                                            <label class="mt-radio mt-radio-outline">
                                                <input type="radio" class="" name="contentType" value="2" placeholder="" {eq name="info.contentType" value="2"} checked {/eq} >
                                                视频
                                                <span></span>
                                            </label>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row image">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                    </label>
                                    <div class="col-md-9">
                                        <div id="cover-image" class="cover-image">
                                            {volist name="imgList" id="vo"}
                                            <span class="multi-image">
                                                <input type="hidden" name="imgIds" value="{$vo.id}">
                                                <input type="hidden" name="imgUrl" value="{$vo.imgUrl}">
                                                <img class="exist-image" src="{$vo.imgUrl}" alt="">
                                                <img class="del" src="__STATIC__/pages/image/del.png" alt="">
                                            </span>
                                            {/volist}
                                            <span id="upload-cover-btn" data-multi="true" data-ajax="true" data-field="imgUrl">
                                                <img src="__STATIC__/admin/img/default.png" alt="图片上传" style="width: 100px;height: 100px;" />
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row video hide">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                    </label>
                                    <div class="col-md-9">
                                        <div id="upload-video">
                                            <span id="upload-video-btn" data-multi="false" data-extensions="mp4" data-max_file_size="10M">
                                                <input type="hidden" class="form-control" id="videoUrl" name="videoUrl" value="{$info.videoUrl}">
                                                <div class="uploader-div">
                                                    <video class="img-responsive" name="img_qiniu_url" src="{$info.videoUrl}" />  <source name="img_qiniu_url"  class="img-responsive" src="{$info.videoUrl}"  type="video/mp4" /> </video>
                                                </div>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <input type="hidden" name="id" value="{$info.id}">

                        <hr />
                        <div class="row">
                            <div class="form-actions">
                                <div class="col-md-offset-2 col-md-10">
                                    <button type="button" id="form-submit" class="btn blue save-btn">
                                        保存 <i class="fa fa-floppy-o"></i>
                                    </button>
                                    <button type="button" class="btn default" onclick="history.go(-1);">
                                        返回 <i class="fa fa-mail-forward"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">

<input type="hidden" class="save_url" value="{:url('admin/'.strtolower($model).'/editpost')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/admin/js/qiniu/plupload.full.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniu.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/qiniu/qiniuConfig.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/uploadfile.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/knowledge.js" type="text/javascript"></script>
{/block}